package com.pai4j.remote.user;
import com.pai4j.common.bean.PAIPageResponseBeanUtil;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.domain.vo.request.request.payment.CreateAppRequestVO;
import com.pai4j.domain.vo.response.payment.AppBaseResponseVO;
import com.pai4j.domain.vo.response.payment.CreateAppResponseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "pai4j-user-service", contextId = "accessApplicationServiceClient")
public interface AccessApplicationServiceClient {

    @PostMapping("/user-service/app/check/{ak}/{sk}")
    PAIResponseBean<Boolean> checkAkSk(@PathVariable String ak, @PathVariable String sk);

    /**
     * 支付平台创建应用（接入方）
     *
     * @param createAppRequest
     * @return
     */
    @PostMapping("/user-service/app/create")
    PAIResponseBean<CreateAppResponseVO> createApp(@RequestBody CreateAppRequestVO createAppRequest);

    /**
     * 发布app
     *
     * @return
     */
    @PostMapping("/user-service/app/publish/{appId}")
    PAIResponseBean<Boolean> publishApp(@PathVariable Long appId);

    /**
     * 删除app
     *
     * @param appId
     * @return
     */
    @PostMapping("/user-service/app/delete/{appId}")
    PAIResponseBean<Boolean> deleteApp(@PathVariable Long appId);


    /**
     * 应用列表
     *
     * @param keywords
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping("/user-service/app/page")
    PAIPageResponseBeanUtil<AppBaseResponseVO> page(@RequestParam(value = "keywords", required = false) String keywords,
                                                    @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                                    @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);
}
